package com.yuliang.controller;


import com.yuliang.annotation.SystemLog;
import com.yuliang.domain.R;
import com.yuliang.domain.entity.User;
import com.yuliang.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
@Api(description = "用户相关接口")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/userInfo")
    public R getUSerInfo(){
        return userService.userInfo();
    }

    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public R updateUserInfo(@RequestBody User user){
        return userService.updateUserInfo(user);
    }

    @PostMapping("/register")
    public R register(@RequestBody User user){
        return userService.register(user);
    }
}
